package xyz.renyumeng.xkm.client.es;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import xyz.renyumeng.xkm.dto.base.SearchPage;
import xyz.renyumeng.xkm.model.es.EsProduct;

import java.util.List;

/**
 * @author renyumeng
 * @date Created in 9:41 2023/7/4
 */

@RestController
@FeignClient(
        value = "service-es",
        contextId = "shop"
)
@RequestMapping("/admin/es/shop/inner")
public interface EsShopFeignClient {
    @GetMapping("/{page}/{size}")
    SearchPage<List<EsProduct>> pageWithFilter(@PathVariable Integer page,
                                               @PathVariable Integer size,
                                               @RequestParam(value = "filter", required = false) String filter);

    @GetMapping("/{productId}")
    EsProduct getEsProductById(@PathVariable Long productId);


    @GetMapping("/owner/{page}/{size}/{ownerId}")
    SearchPage<List<EsProduct>> pageByOwnerId(
            @PathVariable Integer page,
            @PathVariable Integer size,
            @PathVariable Long ownerId
    );

    @GetMapping("/owner/isSole/{page}/{size}/{ownerId}")
    SearchPage<List<EsProduct>> pageByOwnerIdIsSole(
            @PathVariable Integer page,
            @PathVariable Integer size,
            @PathVariable Long ownerId,
            @RequestParam(value = "isSole") Integer isSole
    );

    @GetMapping("/isListed/{productId}/{isListed}")
    Boolean getEsProductIdWithIsListed(@PathVariable Long productId,@PathVariable Integer isListed);
}
